package com.yunfei.mapper.aiiidb;

import com.yunfei.bo.KeFuUserBo;
import com.yunfei.bo.LiCaiShiUserBo;
import com.yunfei.bo.TPersonalUserBo;
import com.yunfei.bo.TPersonalUserChildBo;
import com.yunfei.entity.TPersonalUserEntity;
import com.yunfei.mapper.BaseDao;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
    * tPersonalUserSystem 实体类
    * Sun Apr 08 11:56:27 CST 2018 zhengyunfei
    */

@Mapper
public interface TPersonalUserMapper<T> extends BaseDao<T> {
	/**
	*新增
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 String add(TPersonalUserBo bo);
	/**
	*批量新增
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 String batchInsert(List bo);
	/**
	*修改
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 String update(TPersonalUserBo bo);
	/**
	*删除
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 String delete(String id);
	/**
	*根据Id查询
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	TPersonalUserEntity findById(String id);
	/**
	*根据Id查询
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	TPersonalUserEntity findByMap(Map queryMap);
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 List<TPersonalUserEntity> findAllList(TPersonalUserBo bo);
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 List<TPersonalUserEntity> findAllList(Map<String, Object> queryMap);
	/**
	*查询所有信息
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 List<TPersonalUserEntity> findAllList(TPersonalUserBo bo, int curNo, int curSize);
	/**
	*根据Id查询
	*@author zhengYunFei
	*@date Sun Apr 08 11:56:27 CST 2018
	*/
	 int count(TPersonalUserBo bo);

	TPersonalUserEntity findByBo(TPersonalUserBo param);
	String getCurrentUserId(HttpServletRequest request);
	/**
	 * 保存用户基本信息到redis中
	 * @author zhengyunfei
	 */
	void saveUserToRedis(TPersonalUserBo userBo);

	/**
	 * 更新子女基本信息redis缓存
	 * @author zhengyunfei
	 * @param request
	 * @param childList
	 */
	void updateUserInfoChildrensToRedis(HttpServletRequest request, List<TPersonalUserChildBo> childList);
	void updateUserInfoChildrensToRedis(HttpServletRequest request, List<TPersonalUserChildBo> childList, String userId);

	/**
	 * 从缓存中获取用户信息
	 * @author zhengyunfei
	 * @param request
	 * @param modelMap
	 */
	TPersonalUserBo getUserInfoFromRedis(HttpServletRequest request, ModelMap modelMap);

	/**
	 * 从缓存中获取子女基本信息
	 * @author zhengyunfei
	 * @param request
	 * @param modelMap
	 */
	List<TPersonalUserChildBo> getUserInfoChildrensFromRedis(HttpServletRequest request, ModelMap modelMap);
	/**
	 * 从缓存中获取子女基本信息
	 * @author zhengyunfei
	 * @param request
	 * @param modelMap
	 */
	List<TPersonalUserChildBo> getUserInfoChildrensFromRedis(HttpServletRequest request, ModelMap modelMap, String userId);
	/**
	 * 根据userId获取用户基本信息
	 * @author zhengyunfei
	 * @param userId 传递的用户id
	 */
	TPersonalUserBo getUserInfoFromRedis(String userId) ;
	/*
	*根据随机数，判断是否可以发送验证码
	 */
	 boolean isSendCodeFlag(String r);
	/**
	 * @Description: 在需要发送短信的页面，必须调用此方法，并返回随机码给页面，发送验证码的时候，页面需要回传此随机码给发送验证码的方法，校验正确，才可以发送验证码
	 * 生成随机码的有效期是5分钟
	 * @Author: zhengyunfei
	 * @Date: 2018/5/11
	 * @time:16:44
	 */
	 void createCodeRandom(Model model);
	/**
	 * @Description: 校验验证码是否正确
	 * @return: boolean
	 * @Author: zhengyunfei
	 * @Date: 2018/5/14
	 * @time:17:41
	 */
	 boolean isCodeSuccess(String mobile, String code);

    String getLiCaiShiInfo(String userId);

    List<KeFuUserBo> getKeFuUserList(KeFuUserBo page);

	int getKeFuUserListSize(KeFuUserBo param);
	//发送短信和邮件给客服
	boolean sendMessageAndMailToKeFu(TPersonalUserBo userBo);
	//判断邀请码是否存在
	int getYqmExsit(TPersonalUserBo userBo);

    List<LiCaiShiUserBo> getLiCaiShiUserList(LiCaiShiUserBo queryParam);

	int getLiCaiShiUserListSize(LiCaiShiUserBo queryParam);
	int getReportStatus(String mobile);

	List<TPersonalUserEntity> getCrmUserMobileList();
	//更新用户登录次数
    void updateLoginCount(TPersonalUserBo personalUserBoParam);

	String getLiCaiShiUserId(TPersonalUserBo tPersonalUserBo);
	String getUserId(TPersonalUserBo tPersonalUserBo);
}

